﻿using Newtonsoft.Json;
using SqlSugar;
using System.ComponentModel.DataAnnotations;

namespace AdminBase.Model.Entitys
{
    /// <summary>
    /// 用户
    /// </summary>
    public class Users : EntityCommon
    {
        /// <summary>
        /// 用户名，用于登录
        /// </summary>
        [JsonProperty("userName")]
        [SugarColumn(IsNullable = false)]
        [Required(ErrorMessage = "用户名是必填项")]
        public string? UserName { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        [JsonProperty("password")]
        [SugarColumn(IsNullable = false)]
        public string? PassWord { get; set; }

        /// <summary>
        /// 盐值
        /// </summary>
        [JsonProperty("salt")]
        public string? Salt { get; set; }

        /// <summary>
        /// 姓名
        /// </summary>
        [JsonProperty("fullName")]
        public string? FullName { get; set; }

        /// <summary>
        /// 手机号
        /// </summary>
        [JsonProperty("mobile")]
        public string? Mobile { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        [JsonProperty("email")]
        public string? Email { get; set; }

        /// <summary>
        /// 登录尝试次数：记录用户连续失败的登录尝试次数，用于防止暴力破解。
        /// </summary>
        [JsonProperty("loginFailNum")]
        public int LoginFailNum { get; set; }

        /// <summary>
        /// 是否已被锁定：标记用户账户是否被锁定（如多次登录失败、离职）。
        /// </summary>
        [JsonProperty("isLocked")]
        public bool IsLocked { get; set; }

        /// <summary>
        /// 最后登录时间
        /// </summary>
        [JsonProperty("lastLoginDateTime")]
        public DateTime? LastLoginDateTime { get; set; }

        /// <summary>
        /// 部门ID
        /// </summary>
        [JsonProperty("departmentID")]
        public long? DepartmentID { get; set; }

        /// <summary>
        /// 头像，文件ID
        /// </summary>
        [JsonProperty("avatar")]
        public string? Avatar { get; set; }

        /// <summary>
        /// 是否激活
        /// </summary>
        [JsonProperty("isActive")]
        public bool IsActive { get; set; }

        /// <summary>
        /// 是否是超级用户
        /// </summary>
        [JsonProperty("isSuperUser")]
        public bool IsSuperUser { get; set; }
    }
}